home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR02 / DCGAMES1.ZIP / SCRIPTS.ZIP / DCSCRIPT.DOC < prev    next >
Text File  |  1993-04-08  |  79KB  |  2,219 lines

  1. NOTE: This manual was written in a graphics word processing system
  2. (Ami Pro 2.0).  This text file contains most of the text in the 
  3. manual, but the graphics are lost and the tables are not formated.
  4.  
  5. When you register, you can get a copy of the documentation for
  6. only $5 to cover the cost of printing and shipping. See INVOICE.DOC
  7. for details.
  8. --------------------------------------------------------------------
  9.  
  10. Introduction ............................................1 
  11. Preface .................................................1 
  12. Document Organization ...................................1 
  13. Conventions .............................................2 
  14. Getting Help ............................................2 
  15. Basic Information .......................................3 
  16. What is a script? .......................................3 
  17. What is a script used for? ..............................3 
  18. Character scripts .......................................3 
  19. Object scripts ..........................................4 
  20. World script. ...........................................5 
  21. Control script ..........................................5 
  22. Magic Spells ............................................5 
  23. Game Initialization Script ..............................6 
  24. Dead and Resurrection ...................................6 
  25. Basic Script Elements ...................................7 
  26. Keywords ................................................7 
  27. Keywords Table ..........................................8 
  28. Comments ................................................8 
  29. Numbers .................................................9 
  30. Tokens ..................................................9 
  31. Variables ...............................................10 
  32. Generic Variables (Local and Global) ....................10 
  33. String Variables ........................................10 
  34. World Variables and Attributes ..........................11 
  35. Object Variables and Attributes .........................11 
  36. Character Variables and Attributes ......................13 
  37. Group Variables and Attributes ..........................14 
  38. Types of Scripts ........................................15 
  39. Introduction Script .....................................15 
  40. Character Script ........................................16 
  41. Object Script ...........................................17 
  42. World Script ............................................18 
  43. Control Script ..........................................18 
  44. Resurrection Script .....................................18 
  45. Writing Scripts .........................................19 
  46. Script Files ............................................19 
  47. Expressions and Assignments .............................20 
  48. Function Table ..........................................21 
  49. Statements ..............................................22 
  50. Conditional Statements ..................................22 
  51. Flow Control Statements .................................23 
  52. Flow control using if ...................................23 
  53. Flow control using on-goto ..............................23 
  54. Loop Control Statements .................................24 
  55. The while statement .....................................24 
  56. The for statement .......................................24 
  57. The foreach statement ...................................24 
  58. Object Manipulation Statements ..........................25 
  59. Move and Copy ...........................................25 
  60. Drop ....................................................25 
  61. Output Statements .......................................25 
  62. Write and Writeln .......................................25 
  63. Display .................................................26 
  64. Input Statements ........................................26 
  65. Getstr and Getnum .......................................26 
  66. Select ..................................................26 
  67. Going Places ............................................26 
  68. Animation ...............................................27 
  69. Entering Doors ..........................................27 
  70. Teleportation ...........................................27 
  71. Advanced Topics .........................................27 
  72. Entry Points ............................................27 
  73. Calling A DOS program ...................................28 
  74. Creating New Types and Classes ..........................29 
  75. New Character Types .....................................29 
  76. New Character Classes ...................................29 
  77. New Object Types ........................................30 
  78. New Object Classes ......................................30 
  79. New Object Modifiers ....................................31 
  80. New World Types .........................................32 
  81. Shareware Opportunities .................................33 
  82. Extending the magic system ..............................33 
  83. MS-DOS based extensions .................................33 
  84. Writing a whole new system ..............................34 
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.                                 D C  -  G A M E S 
  93.  
  94.  
  95.  
  96.  
  97.  
  98.                                   Version 3.0
  99.  
  100.  
  101.  
  102.                            SCRIPT LANGUAGE USER'S GUIDE
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.                                   March 1993
  116.  
  117.  
  118.                             (c) DC Software, 1992
  119.                                 6705 Laramie Dr.
  120.                                 Plano TX 75023
  121.                                 (214)517-0428
  122. Introduction 
  123.  
  124. Preface
  125.  
  126. One of the goals of the DCGAMES adventure and role-playing game
  127. building system is to provide an environment in which you can
  128. create adventure games without having to know anything about
  129. computer programming, and without having to maintain a zillion
  130. lists of cryptic numbers.  If you want to draw a river, you just
  131. do it.  If you want to create a dragon, just grab the right
  132. picture and do it.  The idea is to have a large enough set of
  133. objects, characters, monsters and landscaping to allow you to
  134. concentrate on the story.
  135.  
  136. While this works fine most of the time, it is almost inevitable
  137. that there will be a few things you need to do that I didn't
  138. think of, or which need to work slightly different.  You may
  139. need a new type of character or object, or some new magic
  140. spells.  Maybe the wizards are too wimpy or elves and dwarfs
  141. should not exist in your adventure.
  142.  
  143. Most of the features in the DCGAMES system are handled by
  144. scripts.  The script language is a simple yet powerful language
  145. that the game driver understands, and which control the behavior
  146. of most parts of the game system.
  147.  
  148. The scripts are created using a standard text editor, and can be
  149. as simple or complex as you need them to be.  While you can
  150. write a complete game without writing a single line of script, a
  151. small effort on your part to learn how to write script will
  152. result in significantly better games, since you can fine-tune
  153. your creation to work exactly the way you want it to work.
  154.  
  155. Document Organization
  156.  
  157. This manual is organized in several sections.  The first one is
  158. an introduction to the elements of the DCGAMES system.  It
  159. explains each of the building blocks used to create an
  160. adventure, and how (and why) you would want to customize them. 
  161. Everyone should read this section!
  162.  
  163. The second section is a Reference Manual, which is a list of the
  164. features of the script language in a logical order.  You will
  165. need a printed copy of that section of the manual when you are
  166. actually writing a script.
  167.  
  168. Conventions
  169.  
  170. In this document, the following conventions are used:
  171.  
  172. UPPER-CASE-WORDS
  173.  
  174. represent tokens that have a specific value and are typed
  175. exactly as shown.
  176.  
  177. italic-words
  178.  
  179. are used when a new concept is being introduced, and the world
  180. in italics is the name of that concept.  They are also used to
  181. indicate that you should be replace the word with an appropriate
  182. name or value.
  183.  
  184. bold-words
  185.  
  186. represent names or values that should be typed exactly as shown.
  187.  
  188. text1 | text2
  189.  
  190. items separated by a vertical bar (|) mean you get to choose one
  191. of them.
  192.  
  193. [ ]
  194.  
  195. items enclosed in square brackets are optional.  If multiple
  196. items are listed, separated by a vertical bar, then you may
  197. choose one of them or none.
  198.  
  199. { text1 | text2 }
  200.  
  201. items enclosed in curly braces are NOT optional.  You must
  202. select one of the items listed.
  203.  
  204. ...
  205.  
  206. three dots (ellipsis) indicate that the previous item can be
  207. repeated multiple times.  If there is a limit to the number of
  208. times an item can be repeated, it will be indicated in a note
  209. near the area where the ellipsis were used.
  210.  
  211. Getting Help
  212.  
  213. Registered users of DCGAMES get free telephone assistance
  214. evenings and weekends.  This assistance may range from
  215. explaining how a certain feature works to guidance in how to add
  216. a new feature.  I might even write some specialized scripts for
  217. you (within reason).
  218.  
  219. Non-registered users are welcome to call also.  I will try to
  220. answer questions over the phone, but please keep your questions
  221. simple and organized.  If you feel you can't afford to pay for
  222. the game, I've been known to accept a smaller amount or even
  223. waive the fee in exchange for some serious feed back or some
  224. outstanding artwork or sound recordings that I may incorporate
  225. into the shareware product. Basic Information
  226.  
  227. What is a script?
  228.  
  229. A script is a text file, created using a simple text editor (If
  230. you use a word processor, be sure to store the file in 'ASCII'
  231. or 'PLAIN TEXT' format).
  232.  
  233. The script file contains the instructions that tell the game
  234. driver (DCPLAY program) how to handle most aspects of the game. 
  235. The system includes a large number of predefined scripts to
  236. handle objects, characters, worlds, etc.  You can modify these
  237. scripts to meet your game's individual requirements, and you can
  238. write whole new scripts to extend the number of options you have.
  239.  
  240. The script language was designed to be easy to learn and use. 
  241. The documentation was written specifically for people that have
  242. no prior exposure to programming, and the predefined scripts
  243. have extensive annotations to help you understand them and learn
  244. from them.
  245.  
  246. A good thing to remember is that you cannot cause any damage
  247. through experimentation.  The worst you can do is to make some
  248. changes to a script that prevent it from operating properly.  
  249. All you have to do is retrieve a copy of the original script
  250. (which you saved before you modified the script, right? right!) 
  251. or at worst, you can give me a call and I will help you fix it.
  252. Don't be afraid to try!
  253.  
  254. What is a script used for?
  255.  
  256. The game builder (DCWORLD program) is used to create worlds. You
  257. use landscaping graphics blocks to paint the different worlds,
  258. you open doors between them to allow the game player to move
  259. from one world to another.  You then add characters and objects
  260. to the worlds, populating towns, cities, castles and dungeons,
  261. each of them having it's own reason for existing in your
  262. universe. 
  263.  
  264. The DCGAMES system includes a large set of predefined scripts
  265. which are used to handle your game.  While these scripts are
  266. complete, you may want to modify them or write new scripts to
  267. handle your specific needs. The type of script you write depends
  268. on the aspect of the game that you want to control.
  269.  
  270. Character scripts
  271.  
  272. Every character in your game will have a character type
  273. associated with it.  You specify the type when you create the
  274. character using the DCWORLD program. Each character type is
  275. completely defined with a script file.
  276.  
  277. DCGAMES includes a full set of character scripts that implement
  278. the following character types:  Adventurer, Bartender, Beggar,
  279. Civilian, Guard, Healer, Merchant, Prisoner, Teller and Trainer.
  280.  
  281.  
  282. The behavior of these character types is described in detail in
  283. the DCGAMES User's Guide.  One of the best ways to become
  284. quickly familiar with the script language is to compare the
  285. description of the character type as documented in the User's
  286. Guide with the actual script that makes the character behave
  287. that way.
  288.  
  289. The name of the character script is created by taking the first
  290. 8 characters of the character type and adding the extension
  291. .SCR.   Thus, a healer's script is HEALER.SCR, and a bartender's
  292. script is BARTENDE.SCR.
  293.  
  294. Of course, you may add new character types by creating new
  295. scripts, or you can modify existing scripts if the character
  296. type doesn't meet your exact needs.
  297.  
  298. Object scripts
  299.  
  300. Objects, like characters, behave in predictable ways depending
  301. on the object's type. Unlike characters, however, a single
  302. script handles all of the object types.
  303.  
  304. The script OBJECT.SCR is by far the most complex script
  305. provided.  It can handle object of type Food, Weapon,
  306. Ammunition, Armor, Shield, Amulet, Ring, Potion, Scroll, Staff,
  307. Chest, Keys, Gems, Book, Gold Sack, Torch, Lantern, Rope, Hooks,
  308. Mirror, Sign and Vehicle.
  309.  
  310. When the game driver needs to handle an object, it checks to see
  311. if it has a script assigned to it.  If it does, the object's
  312. script is given the opportunity to handle the action that the
  313. game driver is trying to accomplish.  If the object does not
  314. have a script, or, if it does have a script but the script does
  315. not handle that particular action, then the OBJECT script is
  316. invoked.
  317.  
  318. You can alter the behavior of an object in several ways. You may
  319. modify the OBJECT.SCR to alter the way existing objects types
  320. work, or define new object types; You can also create a brand
  321. new script file to control the behavior of a specific object.
  322.  
  323. For example, if your adventure is loosely based on 'Snow White
  324. and the Seven Dwarfs', you definitely need a 'mirror' that can
  325. talk back to you.  Mirrors as handled by the OBJECT script have
  326. no special features. You can modify the script so that two
  327. classes of mirrors exist. Normal mirrors, which do nothing
  328. special, and Magic mirrors, which have special uses. This
  329. modification means you can now create any number of normal or
  330. magic mirrors. 
  331.  
  332. However, if you only need ONE magic mirror, with some very
  333. specific behavior, you may just create a separate script for
  334. that particular item.  The script doesn't even have to handle
  335. most of the actions that you can perform on a mirror.  It only
  336. has to handle the situation where the character TALKS to the
  337. mirror.  Any other action, such as GET, DROP, LOOK, etc, can be
  338. handled by the OBJECT script.
  339.  
  340. World script.
  341.  
  342. A world is the scenario upon which your adventure takes place. 
  343. A world's most visible attribute is it's graphical landscaping,
  344. but worlds, just like characters and objects, worlds can be
  345. configured with special attributes and have a script associated
  346. with them.
  347.  
  348. When the player enters or exists a world, the world's script is
  349. executed. The predefined script WORLDDEF.SCR is executed if you
  350. don't provide one of your own. The world's script can deny
  351. access to the world, or send the character to a different
  352. destination within the same world or in any other world.
  353.  
  354. The game system includes 10 different types of worlds: Outdoors,
  355. City, Town, Dungeon, Hideout, House, Castle, Arena, Haunted and
  356. End-Game.  The world's type affects different aspects of the
  357. game system.  For example, in OUTDOOR type worlds if you walk
  358. all the way to the edge of the world you 'wrap around' to the
  359. other side.  (i.e. the world is round), but in a town or city,
  360. if you walk to the edge you leave the city and go back to the
  361. place where you originally came from.
  362.  
  363. Control script
  364.  
  365. The game system includes the concept of time.  You have complete
  366. control over the duration of a minute, the number of minutes per
  367. hour, hours per day, days per month and months per year.  
  368.  
  369. Once a minute (in game time), the CONTROL script is invoked. 
  370. This script performs tasks that depend on time, such as
  371. restoring health, causing damage to exhausted, famished or sick
  372. players, creating random monsters, etc.  You can add your own
  373. timed events to the control script.
  374.  
  375. The script is also called when the party decides to rest
  376. (Camp-out command) and when a member of the party is asked to
  377. leave.
  378.  
  379. Magic Spells
  380.  
  381. The OBJECT script includes two kinds of magical objects.  Food,
  382. Potions, Rings, Amulets and Gems all have personal magic, which
  383. is invoked on the individual that uses the object.  Staffs and
  384. Scrolls have external magic, which affect individuals other than
  385. those that use them.  You can, of course, modify the
  386. implementation of magic at will.
  387.  
  388. When a magic user Casts a spell, no object is involved, so a
  389. separate script (CASTING.SCR) is used to control magic user
  390. spells.  The casting scripts allows Wizards and Elves to cast
  391. external magic spells as long as they have enough power points
  392. to handle the spell.  You could easily change this script to
  393. have a multi-level spell system which allows only certain spells
  394. within each level, or you could create a new character type (say
  395. Cleric) that has a different set of spells than a Wizard or Elf.
  396.  
  397. Game Initialization Script
  398.  
  399. When the game first starts, the INITGAME script will be invoked.
  400.  This script is used to present the game's story.  You can use
  401. voice, music, graphics, text, animation, etc.
  402.  
  403. Within this script you have the chance to create the player's
  404. character.  If you don't, the game system will invoke the
  405. standard character creation screen after the  INITGAME script is
  406. done.
  407.  
  408. Dead and Resurrection
  409.  
  410. When all members of the playing party die, the resurrection
  411. script will be invoked to allow you to perform standard actions
  412. such as save, restore, restart or even revive the party and give
  413. the player another chance.
  414.  
  415. The predefined resurrection  script (RESURECT.SCR) will keep
  416. giving the player another chance as long as the player's level
  417. exceeds the number of times the player has died. Basic Script Elements
  418.  
  419. This section introduces the basic elements that form the script
  420. language. Just like in English you use words to build sentences,
  421. and those words are classified into verbs, adjectives, etc, so
  422. does the script language use a basic set of elements to build
  423. it's sentences.
  424.  
  425. The script language contains the following basic elements:
  426. Keywords, Tokens, Constants,  Variables, Structures, Statements,
  427. Functions, Procedures, Comments.  Let's look at each one in turn.
  428.  
  429. Keywords
  430.  
  431. A keyword is a word that has a special meaning in the script
  432. language. They are presented in alphabetical order, but grouped
  433. into primary, secondary and function keywords.
  434.  
  435. A primary keyword is equivalent to a verb in the English
  436. language.  It indicates the action taking place.
  437.  
  438. Secondary keywords are used to complement primary keywords and
  439. have meaning only within the context of a primary keyword.  For
  440. example:
  441.  
  442. if player.name = "Henry" and fighting then write("Go Away");
  443. endif;
  444.  
  445.  
  446.  
  447. In the above line, the if and write keywords are primary, then,
  448. and endif are secondary because they have a meaning only in
  449. relation to the if keyword.
  450.  
  451. Function keywords are used to determine (or modify) a system 
  452. value.  For example, if the keyword fighting has a non-zero
  453. value it indicates that a fight is currently taking place.
  454.  
  455. Note that player.name is not a keyword, it is a variable
  456. (player) and an attribute (name).  Variables and their
  457. attributes are covered in elsewhere.
  458.  
  459. The section Writing Scripts in this manual introduces most of
  460. the keywords using simple examples.  A detailed description of
  461. each keyword can be found in the Script Language Reference Guide.
  462. Keywords Table
  463.  
  464. Primary Keywords   Primary (continued)    Function Keywords 
  465. continue           save                   abs
  466. copy               select                 adjustments
  467. dec                setbody                Day
  468. display            setbp                  DaysInAMonth
  469. drop               stats                  DefCaveBlk
  470. endgame            stop                   DefLandBlk
  471. enter              teleport               DefPack
  472. fight              vanish                 DefSpookBlk
  473. find               viewpcx                DefStat
  474. for                voice                  DefWaterBlk
  475. foreach            vplay                  fighting
  476. frame              wait                   failure
  477. getnum             while                  group
  478. getstr             write                  Hour
  479. goto               writeln                HoursInADay
  480. gosub              Secondary              Keywordsmax
  481. if                 and                    min
  482. inc                by                     Minute
  483. join               else                   MinutesInAnHour
  484. leave              elsif                  Month
  485. loadhint           end                    MonthsInAYear
  486. loadtext           endif                  MovesPerMinute
  487. locate             endfor                 object
  488. move               endwhile               player
  489. npc                matching               random
  490. on                 not                    success
  491. paint              or                     SunSet
  492. pause              screen                 SunRise
  493. readtext           then                   version
  494. restart            to                     world
  495. restore            window                 Year
  496. return             xor                    
  497.  
  498. Keywords in italics are a special kind of keyword, in that they
  499. represent Control Variables.         
  500.  
  501. Comments
  502.  
  503. A comment is a sequence of characters beginning with the
  504. character '!'.  The exclamation point tells the script language
  505. compiler that the text that follows is a comment and should be
  506. ignored.  Comments are used to document your scripts so they are
  507. easier to understand.
  508.  
  509. For example:
  510.  
  511. ! This is a comment
  512.  
  513.    ! This is also a comment! All of it..
  514.  
  515. !!! This is another comment.
  516.  
  517.  
  518.  
  519. Note that all text following first ! is part of the comment,
  520. including any other ! character.
  521.  
  522. Numbers
  523.  
  524. Numbers are very important in DCGAMES.  
  525.  
  526. They are used extensively to identify the attributes of objects
  527. and characters. As a rule, numbers can be values between
  528. -2147483647 and 2147483647.  While this is true for constants,
  529. when using numbers, you will usually have to restrict them to be
  530. within the range of values allowed for the purpose you are using
  531. the number for.  For example, a ring object has an attribute
  532. called charges which holds the number of times the ring can be
  533. used.  This attribute can have a value between 0 (no charges
  534. left) and 255.  Trying to set the charges attribute to 500 will
  535. result in a warning message, and assign the maximum allowed
  536. value of 255. The range of values that an attribute can take are
  537. documented along with each attribute in the section entitled
  538. STRUCTURES further on in this chapter.
  539.  
  540. Tokens
  541.  
  542. When you write a script, you frequently need to examine and
  543. modify the attributes of objects and characters, or to perform
  544. different actions depending on the values of the same.  While
  545. most of these attributes are numeric, you don't need to remember
  546. what each number means.  Instead, tokens have been defined that
  547. represent the numeric values.  
  548.  
  549. In this document, tokens are shown in UPPER CASE.  Any name
  550. shown in upper case letters can be considered to be a token.
  551.  
  552. For example.  The standard product includes a set of pre-defined
  553. object types such as FOOD, WEAPON, ARMOR, etc.  The game uses a
  554. number to represent the object's type (0, 1, 2, 3, etc), but it
  555. would be difficult to remember that if you want to create a
  556. WEAPON, you need to set the object's type to 1.  Thus, a token
  557. (namely WEAPON) can be used.  A complete list of predefined
  558. tokens, their values and their usage can be found in the
  559. appendix. 
  560.  
  561. If you modify or extend the set of pre-defined element types,
  562. you will also add new tokens to the file DCCTOKEN.DAT, which
  563. associates the token name with the actual value it is going to
  564. represent.  Once the name has been added to the file, you no
  565. longer have to remember what value you were using for your new
  566. 'type' or 'class' or whatever.
  567.  
  568. Variables
  569.  
  570. A variable is a name used to represent a value, just like a
  571. token, but the difference is that the variable holds a value,
  572. and the value can be modified.  For example, an object could
  573. have a weight of 100, but you can change that value any time.
  574.  
  575. Variables are shown in bold letters in this document.  A
  576. variable may have more than one value associated with it (for
  577. example, an object has a name, a value, a weight, etc.).  The
  578. values associated with the variable are called the attributes of
  579. the variable.
  580.  
  581. The following paragraphs hold a complete list of all variables,
  582. their names, attributes, values and a brief description of the
  583. meaning of the associated value.
  584.  
  585. Generic Variables (Local and Global)
  586.  
  587. There are 256 local variables, named L0 through L255.  They can
  588. hold values between -32768 and +32767.  They are called local
  589. because they exist only during execution of the script.  Once
  590. the script has been executed, any value you placed in them is
  591. lost.
  592.  
  593. Every time a script starts execution, it's local variables are
  594. initialized to zero.  These variables are used mostly for
  595. control purposes and to hold intermediate values.
  596.  
  597.  
  598.  
  599. There are 256 global variables, named G0 through G255.  These
  600. variables can hold values between -32768 and +32767.  They are
  601. called global because they exist for the entire duration of the
  602. game.  If you set one of these variables to a certain value, it
  603. will retain that value until you change it again.  These
  604. variables are used to hold values that are important throughout
  605. the life of the game.  For example, you might use one of these
  606. variables to indicate that a certain action has taken place. 
  607. Other scripts could then check the value of the variable and
  608. take different actions depending on whether the action has taken
  609. place or not.
  610.  
  611. String Variables
  612.  
  613. There are 17 string variables, named S0 through S16.  They are
  614. different from other variables in that they hold TEXT instead of
  615. numbers.  They are also different in that they are used for some
  616. specific purposes, and so, are not "generic".
  617.  
  618. Variable S0 can contain up to 255 characters. While you can use
  619. it for any purpose, it is also used to store any text that the
  620. player types during conversations, as well as other values.  The
  621. getstr() script function asks the user to type something, and
  622. stores that value in this variable (among other things).
  623.  
  624. Variables S1 through S16 can contain up to 64 characters.  These
  625. variables hold the 16 lines of text associated with the current
  626. object or character.  The loadtext() script function will load a
  627. given text record and place each of the lines in the
  628. corresponding variable.
  629.  
  630. World Variables and Attributes
  631.  
  632.  
  633.  
  634. Each world has a certain number of attributes which you can
  635. examine and in some cases modify.  You can only access the
  636. attributes for the world you are currently in. 
  637.  
  638.  
  639.  
  640. Attribute                    Description 
  641.  
  642. name                         Name of the current world, text, 15 chars  
  643. index*                       Current world number  
  644. type                         World's type, 0 - 255  Tokens: OUTDOORS, CITY, TOWN, DUNGEON, HIDEOUT, HOUSE, CASTLE, ARENA and ENDGAME  
  645. x*                           Horizontal size (width) of the current world 
  646. y*                           Vertical size (height) of the current world 
  647. block(x,y)                   Landscaping block # displayed at position x,y 
  648. density(x,y)                 Density of landscaping block at position x,y 
  649. level                        Minimum player level needed to enter this world  
  650. door*                        the door through which you entered the current world  
  651. doorx(door#)                 Horizontal location of the door in the current world  
  652. doory(door#)                 Vertical location of the door in the current world  
  653. destinationworld(door#)      Destination world #   
  654. destinationdoor(door#)       Destination door in the destination world  (non-trap doors only) 
  655. destinationx(door#)          Horizontal location in the destination world (trap doors only) 
  656. destinationy(door#)          Vertical location in the destination world (trap doors only) 
  657. trapdoorswitch(door#)        Is non-zero if the door is a TRAP (destinationx/y instead of destinationdoor)  
  658. entrytext(door#)             Text block # displayed when the player enters the world through the door  
  659. entrytextswitch(door#)       If non-zero, the text is displayed only the first time the door is used  
  660. exittext(door#)              Text block # displayed when the player exits the world through the door 
  661. exittextswitch(door#)        If non-zero, the text is displayed only the first time the door is used  
  662. edgedoor                     The door through which the player exits the current world by walking 'of-the-edge' of the world, or casting the standard 'exit' spell  
  663.  
  664. Object Variables and Attributes
  665.  
  666.  
  667. An object is an item that can be manipulated in many different
  668. ways during game play.  The object's TYPE and CLASS determine
  669. what can be done with the object.
  670.  
  671. Most of the behavior of objects is controlled from the
  672. predefined script OBJECT.  This script can handle objects of
  673. type food, weapon, ammunition, shield, armor, ring, amulet,
  674. scroll, staff, chest, vehicles, etc.
  675.  
  676. Objects     Description 
  677. player.weapon     The weapon wielded by the current player (if any). 
  678. player.armor     The armor worn by the current player (if any). 
  679. player.shield     The shield being used by the current player (if any). 
  680. player.ring     The ring being worn by the current player (if any). 
  681. player.amulet     The amulet being worn by the current player (if any). 
  682. player.staff     The staff being used by the current player (if any). 
  683. player.body     The last selected body item (represents one of player.weapon,
  684.                 player.armor, player.shield, player.ring, player.amulet or
  685.                 player.staff. 
  686. player.bp     The last selected backpack item for the current player.
  687.                 The backpack can hold up to 16 items, but only one of
  688.                 them is selected at a time. 
  689. npc.weapon     The weapon wielded by the current npc (if any). 
  690. npc.armor     The armor worn by the current npc (if any). 
  691. npc.shield     The shield being used by the current npc (if any). 
  692. npc.ring     The ring being worn by the current npc (if any). 
  693. npc.amulet     The amulet being worn by the current npc (if any). 
  694. npc.staff     The staff being used by the current npc (if any). 
  695. npc.body     The last selected body item (represents one of
  696.                 npc.weapon, npc.armor, npc.shield, npc.ring, npc.amulet or
  697.                 npc.staff. 
  698.  
  699. npc.bp      The last selected backpack item for the current npc. 
  700.                 The backpack can hold up to 16 items, but only one of them is
  701.                 selected at a time. 
  702.  
  703. group.vehicle     The vehicle the group is currently on (if any). 
  704.  
  705. object      The object represented by this variable is not being
  706.                 carried by anyone. It exists on it's own in the current world. 
  707.  
  708. curritem     The object represented by this variable is being
  709.                 carried by either the player or the npc character, either in the
  710.                 backpack or being worn.  It is used when the exact location of
  711.                 the object is not important.  
  712.  
  713.  
  714. All of the objects listed above have the same exact attributes,
  715. as follows:
  716.  
  717. Attribute     Description 
  718.  
  719. name         Name of the object (15 characters max). 
  720.  
  721. index             Position in it's current environment (backpack, world,
  722. etc..) 
  723.  
  724. type        Object Type (0-255). Tokens: FOOD, WEAPON, AMMO, ARMOR,
  725. SHIELD, AMULET, RING, POTION, SCROLL, STAFF, CHEST, KEYS, GEMS,
  726. BOOK, GOLDSACK, TORCH, LANTERN, ROPE, HOOKS, MIRROR, SIGN,
  727. VEHICLE.   
  728.  
  729. class             Object Class (0-255).  Class depends on object type. See
  730. Predefined Object Types section for details. 
  731.  
  732. block        Current graphics block #  associated with this object. 
  733.  
  734. picture     Current graphics file # (Filename: OPICTnnn.PCX) 
  735.  
  736. voice             Current voice file # (Filename: VOICEnnn.VFL) 
  737.  
  738. weight       Current weight of the object (1=None, 2-255 lbs, >255
  739. special purpose). 
  740.  
  741. value             Current value of the object in Silver Pieces (10sp =
  742. 1gp). 
  743.  
  744. x            Object's horizontal location (when not being carried). 
  745.  
  746. y             Object's vertical location (when not being carried). 
  747.  
  748. count        Number of objects represented by this single instance. 
  749.  
  750. script      Object's current script file (default = OBJECT), may be
  751. blank. 
  752.  
  753. text               Object's text record (if any). 
  754.  
  755. endgame     0=No, 1=When user GETs object.  2=When user gives the
  756. object to a 'quester' type character.  
  757.  
  758. endtext     Text block # to be displayed when the game ends due to
  759. 'endgame'. 
  760.  
  761. v0 - v7     Object variable.  Use for anything you want. 
  762.  
  763. m0 - m4     Object modifier. Meaning depends on object type and
  764. class.  See Predefined Object Types section for details. 
  765.  
  766.  
  767.  
  768. Character Variables and Attributes
  769.  
  770.  
  771.  
  772. A character in the adventure can be a simple 'extra', with no
  773. other function than to  flesh out a story, or it can be an
  774. integral part of it.  Every character is controlled by a script,
  775. and the system includes a large number of predefined scripts to
  776. handle different types of characters.  Amongst the different
  777. types of characters are: Regular, Bartender, Merchant, Civilian,
  778. Quester, Beggar, etc.  Each of these character types has it's
  779. own script,  and when you create a character, you will usually
  780. select one of these scripts to handle it's behavior.  You may
  781. extend the functionality of each character type by modifying the
  782. scripts, or you can create brand new scripts to handle a brand
  783. new type of character.  For those characters that are central to
  784. the story, you may even want to create a special script that
  785. handles their unique behavior.
  786.  
  787.  
  788.  
  789. When referring to characters, you may talk about the player or
  790. the npc. In any interaction, the player is  a member of the 
  791. game player's party.  The npc is the member with which the
  792. player is interacting.
  793.  
  794.  
  795.  
  796. Attribute     Description 
  797.  
  798. name     Name of the character (15 characters max). 
  799.  
  800. index     Current position in the world. 
  801.  
  802. type     Character Type: (0-255). Tokens: HUMAN, WIZARD, ELF,
  803. DWARF, etc. 
  804.  
  805. class     Character Class (0-255). Depends on character type. See
  806. Predefined Character Types section for details. 
  807.  
  808. block     Current graphics block #  associated with this character. 
  809.  
  810. block2     Alternate graphics block # (used for followers in a
  811. monster party). 
  812.  
  813. picture     Current graphics file # (Filename: CPICTnnn.PCX) 
  814.  
  815. voice     Current voice file # (Filename: VOICEnnn.VFL) 
  816.  
  817. x     Character's horizontal location in the current world. 
  818.  
  819. y     Character's vertical location in the current world.. 
  820.  
  821. count     Number of characters in the party (1-16). 
  822.  
  823. script     Character's current script file (default = OBJECT), may
  824. be blank. 
  825.  
  826. text     Character's text record (if any). 
  827.  
  828. load/mload     Current/Maximum load (how much weight can be
  829. carried) 
  830.  
  831. str/mstr     Current/Normal strength  
  832.  
  833. aim/maim     Current/Normal aim 
  834.  
  835. dex/mdex     Current/Normal dexterity 
  836.  
  837. spd/mspd     Current/Normal speed 
  838.  
  839. pwr/mpwr     Current/Normal magical power points 
  840.  
  841. hp/mhp     Current/Normal Hit Points 
  842.  
  843. iq/miq     Current/Normal intelligence 
  844.  
  845. ac/mac     Current/Normal Armor Class 
  846.  
  847. exp     Current experience points 
  848.  
  849. level     Current character level 
  850.  
  851. poisoned     Character is poisoned 
  852.  
  853. scared     Character is scared 
  854.  
  855. paralyzed     Character is paralyzed 
  856.  
  857. confused     Character is confused 
  858.  
  859. invisible     Character is invisible 
  860.  
  861. energy     Current energy level (From food.  See group.energy for
  862. energy from sleep). 
  863.  
  864. stats     Character statistics record. 
  865.  
  866. v0 - v7     Character variable.  Use for anything you want. 
  867.  
  868. weapon     Currently wielded weapon (if any) 
  869.  
  870. armor     Currently worn armor (if any) 
  871.  
  872. shield     Currently worn shield (if any) 
  873.  
  874. ring     Currently worn ring (if any) 
  875.  
  876. amulet     Currently worn amulet (if any) 
  877.  
  878. staff     Currently wielded staff (if any) 
  879.  
  880. bp     Currently selected backpack object (The backpack can hold
  881. 16) 
  882.  
  883. body     Currently selected body object (if any, one of the
  884. following 6 objects). 
  885.  
  886.  
  887.  
  888. Group Variables and Attributes
  889.  
  890. The group is the party of up to 6 characters that are playing
  891. the game.  Usually, the game starts with only one character in
  892. the group, which is created by the game player.  
  893.  
  894. During the game other players may join the group.
  895.  
  896. Attribute     Description 
  897.  
  898. size*     Current number of characters in the group. 
  899.  
  900. current     Currently selected 'spokesbeing' for the group (0-5). 
  901.  
  902. gold     Total amount of currency carried by the party.  For
  903. consistency, the actual value in this attribute is the amount of
  904. SILVER (divide by 10 to get the amount of gold). 
  905.  
  906. food     The total amount of normal (non-magical) food being
  907. carried by the party. 
  908.  
  909. energy     The group's energy, which is replenished with sleep. 
  910.  
  911. dead_count     Number of times that everyone in the group has died
  912. (and thus, how many times they have been resurrected). 
  913.  
  914. x     Current horizontal location in the current world. 
  915.  
  916. y     Current vertical location in the current world. 
  917.  
  918. moves     Total number of moves since the game started. 
  919.  
  920. block     Graphics block # that represents the group.  Note that
  921. when a fight is taking place, each member of the group is
  922. represented by their own graphics block) 
  923.  
  924. vehicle     Current vehicle (if any).  If the group is riding a
  925. vehicle, the vehicle's graphics block is displayed instead of
  926. the group's graphics block. 
  927.  
  928. Types of Scripts
  929.  
  930. This section talks about the different TYPES of scripts you may
  931. want to write, and tries to point out WHY you would want to
  932. write that kind of script, instead of HOW.  The actual script
  933. language is presented in the section Script Language Programming
  934. Guide later in this manual.
  935.  
  936. Introduction Script
  937.  
  938. The introduction script (INITGAME.SCR) is a script that is
  939. executed only the first time you start playing. Like most games,
  940. you must start of by telling the game player what the story is
  941. about, give some background information, set the mood for the
  942. game.
  943.  
  944. Before the script is invoked, a 'standard' character is created
  945. with the following attributes:
  946.  
  947. group.gold   = 1000;           ! 1000 silver pieces = 100 gold
  948. pieces
  949.  
  950. group.food   = 25;             ! 25 units of food
  951.  
  952. player.name  = "John Doe";     ! Character is called John Doe
  953.  
  954. player.class = 0;              ! First defined player class
  955. (HUMAN usually)
  956.  
  957. player.blk   = 0;              ! First defined character
  958. graphics block.
  959.  
  960. player.level = 1;              ! Level 1
  961.  
  962. player.exp   = 0;              ! No experience at all.
  963.  
  964. player.str and .mstr = *;      ! All attributes are as stored in
  965. record 0 of the
  966.  
  967. player.spd and .mspd = *;      !   statistics file, which can be
  968. modified using
  969.  
  970. player.aim and .maim = *;      !   the DCWORLD program.
  971.  
  972. player.dex and .mdex = *;      !
  973.  
  974. player.iq  and .miq  = *;      !
  975.  
  976. player.pwr and .mpwr = *;      !
  977.  
  978. player.hp  and .mhp  = *;      !
  979.  
  980.  
  981.  
  982. which you may modify as you please along with the rest of the
  983. character attributes.  The character will be positioned over
  984. door 0 in world 0, but you can also change the character's
  985. location from the script.
  986.  
  987. If the script ends with the 'CONTINUE' keyword, the standard
  988. character creation screen will be invoked, and the user will
  989. have a chance to specify a character name, graphics block,
  990. class, and attributes.
  991.  
  992. If you modify the character's name, graphics block or class, 
  993. the player will not be allowed to change it in the character
  994. creation screen.  If you modify an attribute's maximum value
  995. (.mstr, .mspd, .maim, etc) that value will be used as the basis
  996. for character creation.
  997.  
  998. If you set any value below 9 or above 20, that value will be
  999. 'fixed' and the player will not be able to modify it.
  1000.  
  1001. The user will only be allowed to choose graphics blocks marked
  1002. as type 'REGULAR' in the graphics blocks file.  This allows you
  1003. to limit the graphics images that the user may choose.
  1004.  
  1005. A typical introductory script would look like this:
  1006.  
  1007. !
  1008.  
  1009. ! FILE : initgame.scr
  1010.  
  1011. !
  1012.  
  1013.  
  1014.  
  1015. readtext( "intro.txt" );   ! Read some text
  1016.  
  1017. viewpcx ( "intro2" );      ! Show a nice picture
  1018.  
  1019. music   ( "intro2" );      ! Play background music
  1020.  
  1021. wait    ( 120 );           ! Wait until music ends or <SPACE> is
  1022. pressed
  1023.  
  1024.  
  1025.  
  1026. player.class = ELF;        ! Character must be an elf.
  1027.  
  1028. player.mpwr  = 25;         ! Start with 25 power points
  1029.  
  1030. player.hp    = 20;         ! and 20 hit points..
  1031.  
  1032.  
  1033.  
  1034. CONTINUE;                  ! Continue with normal character
  1035. creation
  1036.  
  1037.  
  1038.  
  1039. Note that the READTEXT command has some voice, music and
  1040. graphics capabilities also.  The 'intro.txt' file does not
  1041. necessarily display a single page of text.
  1042.  
  1043. Character Script
  1044.  
  1045. Every character in the game MUST  have a script to control it's
  1046. behavior, except for monsters (type HOSTILE), whose behavior
  1047. consists of chasing the player and fighting to the dead.
  1048.  
  1049. The world builder assumes that the first 8 characters of the
  1050. character TYPE can be used as the name of the character's
  1051. script.  Thus a BARTENDER's script is BARTENDE.SCR, and a
  1052. BEGGAR's script is BEGGAR.SCR. 
  1053.  
  1054. The system provides 11 predefined character scripts, each of
  1055. which has a unique function.  A full explanation of each
  1056. character 'type' as implemented by the scripts can be found in
  1057. the DCGAMES User's Guide.
  1058.  
  1059. Usually, a character script handles conversation.   When the
  1060. player 'talks' to a character, the character takes control of
  1061. the conversation by means of the script.  A merchant, for
  1062. example, asks if you wish to buy or sell something, while a
  1063. healer asks if you need to be cured, healed, etc.
  1064.  
  1065. Special characters may have their own unique script, as is the
  1066. case of JIMMY in the example adventure.  That script does a bit
  1067. of animation when the character is asked to join the adventurer,
  1068. and handles special needs of that character.
  1069.  
  1070. You should print out the character scripts and compare each of
  1071. them with the description of the character type as given in the
  1072. User's Guide. You will then understand how the given script
  1073. implements the behavior.
  1074.  
  1075. There are three ways of working with character scripts.  You can
  1076. modify the default scripts to alter the behavior of existing
  1077. character types, you can create a brand new character type, with
  1078. it's own script, or you can create a unique script for a unique
  1079. character.
  1080.  
  1081. Object Script
  1082.  
  1083. Object scripts are a very different type of animal.  First of
  1084. all, if an object does not have a script, then the OBJECT script
  1085. is invoked.  This script can handle all of the standard actions
  1086. that you can take on all types and classes of objects.  It is by
  1087. far the most complex of the predefined scripts.
  1088.  
  1089. Every time you create a new object type or even a new class
  1090. within an object type, you will need to modify the OBJECT script
  1091. to handle the new object.  For example, mirrors currently don't
  1092. do anything.  If you wanted to have a mirror that shows you an
  1093. area around you, you could create mirror classes.  Class 0 would
  1094. be a normal mirror, while class 1 would invoke a 'view' spell. 
  1095. You can then modify the OBJECT script to check the class
  1096. attribute for mirrors and behave accordingly.
  1097.  
  1098. Now, if you need to have a given object behave differently, you
  1099. need to write a separate script for it.  The script does not
  1100. need to handle all actions on that object, just the ones that
  1101. are different.  For example:  You want to create a magic ring,
  1102. but this ring can cast more than one spell.  You could write a
  1103. special script that has an entry point (see the programming
  1104. guide section) for the WEAR action.  When the character wears
  1105. the ring, your script might display the image of a genie, and
  1106. ask the player what spell is desired.  The script would then
  1107. perform the appropriate spell.
  1108.  
  1109. Remember that if a script does not have an entry point for a
  1110. given action, then a default action is taken.  In this case, the
  1111. default action is to call the OBJECT script.  Thus, all actions
  1112. would be handled by the OBJECT script except WEAR.
  1113.  
  1114. Remember also that if your script ends with CONTINUE instead of
  1115. STOP, the default action is taken anyway, so your script doesn't
  1116. really have to handle the situation.  For example, your 'ring'
  1117. may have a 'random' effect (i.e. you never know what is going to
  1118. happen when you wear it).  To do this, your script would just
  1119. set the ring's class (which determines it's magical effect) and
  1120. terminate with CONTINUE.  The default action would be taken, and
  1121. the OBJECT script would handle the actual magical effect! World Script
  1122.  
  1123. World scripts are executed whenever you ENTER or EXIT the world.
  1124.  The default world script, WORLDDEF.SCR, is invoked if your
  1125. world does not have it's own script.  The world type and other
  1126. attributes configured using DCWORLD allow the WORLDDEF script to
  1127. handle most normal situations.
  1128.  
  1129. World scripts can be very powerful tools to introduce some
  1130. amount of 'sequencing' into the game.  From within a script you
  1131. can change landscaping, doors, etc.  You can also examine and
  1132. change every single object and character in that world.  You
  1133. could have a character that exists only after you have performed
  1134. a certain action.  The world script could check to see if you
  1135. have performed that action every time you enter the world, and
  1136. create the character only when you have done so.
  1137.  
  1138. You can even re-route the player to a different destination
  1139. within the same world, or in a totally different one.
  1140.  
  1141. Control Script
  1142.  
  1143. The control script is the most sensitive script of all.  It is
  1144. called every 'minute' of game play (as defined in the
  1145. MovesPerMinute control variable.  This script handles events
  1146. that depend on time, such as the creation of random monsters and
  1147. the healing of wounds with the passage of time.
  1148.  
  1149. The script is also called every time the game player decides to
  1150. 'rest' his/her party, as well as when a member of the party is
  1151. asked to leave the party.  These are good opportunities for
  1152. control.
  1153.  
  1154. If you need to have certain events happen at certain times, you
  1155. can modify the control script to check the time and perform
  1156. those actions when needed.
  1157.  
  1158. Resurrection Script
  1159.  
  1160. The resurrection script (RESURECT.SCR) is called whenever all
  1161. members of the playing party die.  From this script you have the
  1162. option to give the player a second chance. Once again, you have
  1163. complete control over the situation.  You can terminate the
  1164. game, give the player the option to restart, restore or quit, or
  1165. just restore the player's hit points and continue the game. You
  1166. can also transport the party to another location, and perform
  1167. some cleanup activities.
  1168.  
  1169. Writing Scripts
  1170.  
  1171. Script Files
  1172.  
  1173. A script can be written using any regular text editor or word
  1174. processor.  If you use a word processor, you should save the
  1175. script in ASCII or TEXT format (with no special controls like
  1176. fonts or page formatting).  The script file name should have an
  1177. extension of .SCR, to indicate it contains a script.
  1178.  
  1179. Once the script has been saved, you will use the script compiler
  1180. to translate the script from human readable form (text) into a
  1181. compact code that the game driver understands.  The translated
  1182. code is written into a file with the same name as the original
  1183. file, but with extension of .SCO (for SCript Object).
  1184.  
  1185. For example:
  1186.  
  1187. C:\DCGAME> edit myscript.scr
  1188.  
  1189. ... you create the script using some editor ...
  1190.  
  1191. C:\DCGAME> dir myscript.*
  1192.  Volume in drive C is MYVOLUME
  1193.  Directory of C:\DCGGAME
  1194.  
  1195.  MYSCRIPT SCR      1208 10-29-92   1:25p
  1196.         1 file(s)       1208 bytes
  1197.                      6920192 bytes free
  1198.  
  1199. C:\DCGAME> dcc myscript
  1200. DCGAMES Script Compiler Version 1.0, April 1992
  1201. Copyright (c) 1992 DC Software, 6705 Laramie Dr., Plano, Texas
  1202. Compiling Script <myscript.SCR>
  1203. Code Size = 179
  1204. Data Size = 367
  1205. Labels    = 25
  1206. Compilation successful
  1207.  
  1208. C:\DCGAME> dir myscript.*
  1209.  
  1210.  Volume in drive C is MYVOLUME
  1211.  Directory of C:\DCGGAME
  1212.  MYSCRIPT SCO       604 10-29-92   1:28p
  1213.  MYSCRIPT SCR      1208 10-29-92   1:25p
  1214.         1 file(s)       1208 bytes
  1215.                      6920192 bytes free
  1216.  
  1217. The script MYSCRIPT is now ready to be used in your adventure. 
  1218. Now, every script must be translated in the above manner
  1219. whenever you modify it, or the changes will not be seen by the
  1220. game driver. The game driver uses the .SCO file only.
  1221.  
  1222. To compile ALL the scripts in your current directory, type:
  1223.  
  1224. C:\DCGAME> for %i in (*.scr) do dcc %i
  1225.  
  1226. If you are familiar with any programming language at all, the
  1227. script language will be quite easy to learn, but even if you
  1228. have never learned any programming language, you should be able
  1229. to learn how to write scripts without to much trouble.
  1230.  
  1231. To assist you, the following section sections try to present the
  1232. script language in easy incremental steps, so you may learn at
  1233. your own pace.
  1234.  
  1235. If you get hopelessly lost, give me a call and I will try to
  1236. assist over the phone, but please give it your best shot and try
  1237. to have specific questions written down when you call.  It will
  1238. help keep the phone call as short as possible.
  1239.  
  1240. I urge you to annotate this document wherever you see think
  1241. something being presented poorly, in the wrong order, or just
  1242. plain wrong. This section is the most important one because it
  1243. is the one that enables YOU to write your games.  Send me a copy
  1244. of the pages on which you have made notes and I will gladly
  1245. correct the problem and send you back a new copy with
  1246. corrections as soon as they are made.
  1247.  
  1248. Expressions and Assignments
  1249.  
  1250. An expression is a list of one or more symbols that represent a
  1251. single value. The symbols may be variables, attributes,
  1252. constants, functions or operands.  We already know what
  1253. variables, attributes and constants are.  An operand is a symbol
  1254. that tells the computer that an operation should take place. 
  1255. For example, in the expression 3 * 5 + 2, the * operand tells
  1256. the computer to multiply the constants 3 and 5, and the symbol +
  1257. tells the computer to add two values together..
  1258.  
  1259. In DCGAMES there are 3 types of expressions, arithmetic,
  1260. relational.
  1261.  
  1262. An arithmetic expression is one which takes numeric values (from
  1263. variables, attributes,  constant or functions) and performs an
  1264. arithmetic operation on them.  The arithmetic operands are: *,
  1265. /, +, - and % (this last representing a modulo operation, or the
  1266. 'remainder' portion of an integer division).
  1267.  
  1268. A relational expression is one which compares two numerical
  1269. expressions and results in a logical value (to be specific, a
  1270. relational expression will always result in either a zero or a
  1271. one).
  1272.  
  1273. A logical value is either zero (meaning FALSE) or non-zero
  1274. meaning true.
  1275.  
  1276. Expressions are used in many places, but the most common use of
  1277. expressions is on the right side of an assignment statement. 
  1278. The second most common use for expressions is as part of a flow
  1279. control statement, such as if or on, which are examined a bit
  1280. later.
  1281.  
  1282. A function is much like an operand.  Just like the * sign takes
  1283. two arguments and multiplies them, returning the result as it's
  1284. value, so does a function take it's arguments and return a value
  1285. based on a well defined process.   There are many functions in
  1286. DCGAMES.  This table is a complete list, but a complete
  1287. explanation of each is found in the Script Language Reference
  1288. Guide.
  1289.  
  1290. Function Table
  1291.  
  1292. Function     Description 
  1293.  
  1294. General     General purpose functions 
  1295.  
  1296. abs(expr)     Returns the value of the expression without a sign
  1297. (removes negative signs) 
  1298.  
  1299. adjustments(expr,...)     Returns the sum of the attribute
  1300. adjustments indicated by the expressions 
  1301.  
  1302. find(where,what,type)     Find an object or character 
  1303.  
  1304. getnum(str,low,high)     Display a message and get a value between
  1305. low and high from the player. 
  1306.  
  1307. getstr(str,...)     Get a string from the player and return the
  1308. index of the matching one. 
  1309.  
  1310. locate(what)     Locate an object or npc character by allowing the
  1311. player to point to it. 
  1312.  
  1313. Time Related     Used to control time during game play 
  1314.  
  1315. MovesPerMinute     Number of moves that can be made in one minute
  1316. of game play. 
  1317.  
  1318. MinutesInAnHour     Number of minutes in one hour of game play. 
  1319.  
  1320. HoursInADay     Number of hours in a day of game play. 
  1321.  
  1322. DaysInAMonth     Number of days in a month of game play. 
  1323.  
  1324. MonthsInAYear     Number of months in a year of game play. 
  1325.  
  1326. Year     The current year. 
  1327.  
  1328. Month     The current month of the current year. 
  1329.  
  1330. Day     The current day of the current month. 
  1331.  
  1332. Hour     The current hour of the current day. 
  1333.  
  1334. Minute     The current minute of the current hour. 
  1335.  
  1336. SunRise     The hour of the day at which the sun rises 
  1337.  
  1338. SunSet     The hour of the day at which the sun sets 
  1339.  
  1340. Monster Related     Used to create random monsters 
  1341.  
  1342. DefStat(0-2)     Backpacks that contain likely treasure (usually
  1343. Potions, Rings and Staffs). 
  1344.  
  1345. DefPack(0-3)     The statistics records for SMALL, MEDIUM, LARGE
  1346. and PIRATE monsters. 
  1347.  
  1348. DefLandBlk(0-4)     Graphics blocks for land based monsters
  1349. (ordered, 0=Easy,4=Very Hard) 
  1350.  
  1351. DefCaveBlk(0-4)     Graphics blocks for cave dwelling monsters
  1352. (ordered) 
  1353.  
  1354. DefWaterBlk(0-4)     Graphics blocks for water dwelling monsters. 
  1355. (ordered, 4=Pirate Ship) 
  1356.  
  1357. DefSpookBlk(0-4)     Graphics blocks of skeletons, ghosts, etc.
  1358. (ordered) 
  1359.  
  1360. expr represents any expression that results in a numeric value     
  1361.  
  1362. ... means that any number of the preceding may be listed,
  1363. separated by commas (up to 255 maximum)     
  1364.  
  1365. The  numeric range (0-N) means that a value in the  given range
  1366. must be provided when referring to this variable     
  1367.  
  1368.  
  1369.  
  1370. Examples:
  1371.  
  1372. ! Increase a player's current level
  1373.  
  1374. player.level = player.level + 1;
  1375.  
  1376.  
  1377.  
  1378. ! When selling an object, increase the group's gold by half the
  1379. value of the object.
  1380.  
  1381. group.gold = group.gold - player.bp.value / 2;
  1382.  
  1383.  
  1384.  
  1385. ! Compute the amount of damage done by a weapon, taking into
  1386. account the wielder's
  1387.  
  1388. ! strength (assumes this is not a missile weapon), where
  1389. strength is not important.
  1390.  
  1391. L25 = npc.weapon.damage + adjustments(npc.str);
  1392.  
  1393.  
  1394.  
  1395. ! NOTE: Since relational expressions return 0 if false and 1 if
  1396. true, the following
  1397.  
  1398. !    expression returns a value between 0 and 7, which is the
  1399. number of attributes
  1400.  
  1401. !    of the current npc that exceed 25 points.
  1402.  
  1403. L7 = npc.str > 25 + npc.aim > 25 + npc.dex > 25 + npc.spd > 25 +
  1404.  
  1405.     npc.pwr > 25 + npc.iq > 25;
  1406.  
  1407.  
  1408.  
  1409. ! Change the character's name to "Henry"
  1410.  
  1411. player.name = "Henry";
  1412.  
  1413.  
  1414.  
  1415. Please note that the last assignment statement assigns a string
  1416. value to the name attribute.  The name and script attributes may
  1417. only hold string values.
  1418.  
  1419. Statements
  1420.  
  1421. Just like the English language, the script language uses words
  1422. and symbols to build sentences or statements which tell the game
  1423. driver what to do.  A statement is a complete sequence of words
  1424. and symbols that tell the game driver how to perform a single
  1425. given action.
  1426.  
  1427. A complex statement consists of a one or more statements that
  1428. are grouped together in some fashion to create a more complex
  1429. one. You are already acquainted with the assignment statement,
  1430. now let's look at some other ones, grouped by their nature or
  1431. intended usage.
  1432.  
  1433. Conditional Statements
  1434.  
  1435. In most cases, rather than just assign values to variables, what
  1436. you want to do is take different action depending on certain
  1437. conditions:
  1438.  
  1439. ! Compute the amount of damage done by a weapon, taking into
  1440. account the wielder's
  1441.  
  1442. ! strength IF the weapon is a contact weapon (i.e. not a missile
  1443. weapon).
  1444.  
  1445. if npc.weapon.class = BLUNT or npc.weapon.class = EDGED then
  1446.  
  1447.     L25 = npc.weapon.damage + adjustments(npc.str);
  1448.  
  1449. else
  1450.  
  1451.     L25 = npc.weapon.damage; ! No adjustment for strength
  1452.  
  1453. endif;
  1454.  
  1455.  
  1456.  
  1457. ! The above might also be accomplished as follows
  1458.  
  1459. L25 = npc.weapon.damage;
  1460.  
  1461. if npc.weapon.class = BLUNT or npc.weapon.class = EDGED then
  1462.  
  1463.     L25 = L25 + adjustments(npc.str);
  1464.  
  1465. endif;
  1466.  
  1467.  
  1468.  
  1469. ! Now, the following statement displays the current health
  1470. status of a player
  1471.  
  1472. if player.hp = 0 then
  1473.  
  1474.     writeln( player.name, " is dead!" );
  1475.  
  1476. elsif player.hp = 1 then
  1477.  
  1478.     writeln( player.name, " is unconscious" );
  1479.  
  1480. elsif player.hp < player.mhp
  1481.  
  1482.     writeln( player.name, " is hurt, but still able to function" );
  1483.  
  1484. else
  1485.  
  1486.     writeln( player.name, " is healthy" );
  1487.  
  1488. endif;
  1489.  
  1490.  
  1491.  
  1492. Flow Control Statements
  1493.  
  1494. Sometimes, the if statement can result in long and difficult to
  1495. read statements.  In some cases, it is more appropriate to use
  1496. one of the various forms of the goto or gosub statements to
  1497. accomplish the same goal.
  1498.  
  1499. In order to use these statements, you must first declare one or
  1500. more labels to which the flow of the execution may be
  1501. transferred.  The following examples are equivalent.
  1502.  
  1503. Flow control using if
  1504.  
  1505. :AGAIN
  1506.     L3 = getstr( "Sell", "Buy", "Talk" );
  1507.     if L3 = 0 then
  1508.         ! script for selling goes here
  1509.     elsif L3 = 1 then
  1510.         ! script for buying goes here
  1511.     elsif L3 = 2 then
  1512.         ! script for talking goes here
  1513.     else
  1514.         writeln( "What did you say?" );
  1515.     endif;
  1516.     goto AGAIN;  ! do it again and again, forever.
  1517.  
  1518.  
  1519. Flow control using on-goto
  1520.  
  1521. :AGAIN
  1522.     L3 = getstr( "Sell", "Buy", "Talk" );
  1523.     on L3 goto XSELL, XBUY, XTALK;
  1524.     writeln( "What did you say?" );
  1525.     goto AGAIN;
  1526. :XSELL
  1527.     ! script for selling goes here
  1528.     goto AGAIN;
  1529.  
  1530. :XBUY
  1531.     ! script for buying goes here
  1532.     goto AGAIN;
  1533.  
  1534. :XTALK
  1535.     ! script for talking goes here
  1536.     goto AGAIN;
  1537.  
  1538.  
  1539. When a script is large, a single if statement may be several
  1540. pages long.  It is easy to loose track of what you were trying
  1541. to accomplish.  The on-goto statement has the advantage of
  1542. breaking the logic into separate sections, each self contained
  1543. and self explanatory.   A more complete analysis of the goto,
  1544. gosub, on-goto and on-gosub statements can be found in the
  1545. reference guide.
  1546.  
  1547. Loop Control Statements
  1548.  
  1549. Whenever you need to perform the same operation multiple times,
  1550. a loop statement may come in handy.  The following code shows a
  1551. player giving a copy of everything in his/her backpack to the
  1552. npc character:
  1553.  
  1554. L6 = 0; ! Start with the first backpack object;
  1555.  
  1556. :DOIT
  1557.     setbp(player.bp, L6);        ! Select the Nth backpack object
  1558.     if player.bp.count then        ! If count non-zero, there is an object
  1559.         copy(player.bp,npc);    ! Give a copy of the object
  1560.     endif;
  1561.     inc( L6 );                 ! Same as L6 = L6 + 1;
  1562.     if L6 < 16 goto DOIT;        ! Repeat 16 times
  1563.  
  1564.  
  1565. The above code uses the goto statement to create a loop that
  1566. examines the 16 backpack locations for an object and then copies
  1567. the objects (if they exist) to the npc.
  1568.  
  1569. The while statement
  1570.  
  1571. The while statement simplifies loops by providing an easy way of
  1572. defining a loop without having to declare a label or writing an
  1573. IF statement.  Note that the test for L6 < 16 is made before the
  1574. statements inside the loop are executed.  
  1575.  
  1576. L6 = 0;
  1577. while L6 < 16 do
  1578.     setbp( player.bp, L6 );
  1579.     if player.bp.count then
  1580.         copy( player.bp, npc );
  1581.     endif;
  1582.     inc( L6 );
  1583. endwhile;
  1584.  
  1585.  
  1586. The for statement
  1587.  
  1588. The for statement simplifies the loop even more by allowing you
  1589. to specify both the initial value, the final value and the
  1590. amount by which the control variable (L6) is to be incremented
  1591. (or decremented).  Thus, the loop becomes:
  1592.  
  1593. for L6 = 0 to 15 do
  1594.     setbp( player.bp, L6 );
  1595.     if player.bp.count then
  1596.         copy( player.bp, npc );
  1597.     endif;
  1598. endfor;
  1599.  
  1600.  
  1601.  
  1602. The foreach statement
  1603.  
  1604. To top it of, the foreach statement allows you to select in
  1605. sequence every element of a group.  In this case, the group is
  1606. the set of objects in the backpack.  The foreach loop is
  1607. executed once for each element in the player's backpack.  Empty
  1608. slots are not even selected, so no test is needed.
  1609.  
  1610. Note that if the backpack has NO elements, then the statements
  1611. inside the loop not executed.  This is the best way of examining
  1612. all the elements of a group.
  1613.  
  1614. foreach player.bp do
  1615.     copy( player.bp, npc );
  1616. endfor;
  1617.  
  1618.  
  1619.  
  1620. The foreach statement can select: a) All the characters in the
  1621. player's group, b) All the objects in a character's backpack, c)
  1622. All the objects a character is wearing,  d) All the character's
  1623. in the current world (but not in the player's group) and e) All
  1624. the objects in the current world (but not in anyone's backpack).
  1625.  
  1626. Object Manipulation Statements
  1627.  
  1628. As you saw in the examples above, sometimes you want to move or
  1629. copy objects from one place to another.
  1630.  
  1631. Move and Copy
  1632.  
  1633. When you move an object, it is removed from it's current place
  1634. and inserted in the destination, as long as the destination has
  1635. enough room for it.  If there is not enough room or the
  1636. destination character cannot carry the object, the object is not
  1637. moved. 
  1638.  
  1639. The copy  statement works the same way, but does not delete the
  1640. object from the source, thus making a copy instead of moving the
  1641. object.
  1642.  
  1643. In both cases, you can specify how many objects you want to
  1644. move.  The command will move as many as the destination can
  1645. possibly hold.  If you specify that you want to move or copy
  1646. more objects than are available in the source, additional
  1647. objects are created.
  1648.  
  1649. Drop
  1650.  
  1651. When you drop an object, it is added to the list of objects in
  1652. the world that you are in.  The object will remain where you put
  1653. it.  There are no temporary objects in DCGAMES.
  1654.  
  1655. Output Statements
  1656.  
  1657. Write and Writeln
  1658.  
  1659. When you want to display a value, you have several ways of doing
  1660. it.  The most simple one is the write or writeln statement. 
  1661. With this statement you can display all attributes and variables
  1662. as well as text.
  1663.  
  1664. The following example displays the time of day in the text
  1665. window (assuming that the day has an even number of hours).
  1666.  
  1667. if hour < HoursInADay / 2 + 1 then
  1668.     writeln( "The time is ", Hour, ":", Minute, "am" );
  1669. else
  1670.     L7 = Hour - HoursInADay / 2;
  1671.     writeln( "The time is ", L7, ":", Minute, "pm" );
  1672. endif;
  1673.  
  1674.  
  1675.  
  1676. Display
  1677.  
  1678. The display statement will show a list of items in the menu
  1679. window, with or without numbers or values associated with it. 
  1680. It is useful when you need to show a list of items but are not
  1681. requesting user input.  The many forms of the display statement
  1682. are documented in the reference guide.
  1683.  
  1684. Input Statements
  1685.  
  1686. Frequently, when you display something you are asking the player
  1687. for directions;  During a conversation, you ask the player what
  1688. they want to talk about;  A merchant might display a list of
  1689. items and ask which you want to buy.
  1690.  
  1691. Getstr and Getnum
  1692.  
  1693. The getstr and getnum functions both return a number.  The
  1694. getstr function asks the user to type a string and searches the
  1695. list of strings you provided.  If a match is found, the command
  1696. returns the index of the matching string (i.e. which one
  1697. matched).  If no match is found, the function returns a -1.  In
  1698. any case, the string is stored in the string variable s0.
  1699.  
  1700. The getnum function displays a string and asks the user to enter
  1701. a value in a given range.  Only values in the range are allowed.
  1702.  If the user presses Esc instead of typing a number, the
  1703. function returns -1.
  1704.  
  1705. Select
  1706.  
  1707. The select function displays a menu identical to the one
  1708. displayed by display, but allows the user to select one of the
  1709. entries by using the arrow keys.  This function is used
  1710. extensively, and you should study it with care in the reference
  1711. guide.
  1712.  
  1713. Going Places
  1714.  
  1715. There are several ways in which characters and objects may move
  1716. under script control.
  1717.  
  1718. Animation
  1719.  
  1720. All characters and any object that is not being carried by a
  1721. character has a location within the world reflected by the x and
  1722. y attributes of that character or object.  From a script you may
  1723. modify these attributes and effectively move the characters or
  1724. objects within the limits of the world they are in.  You can
  1725. also change the block attribute to provide some additional
  1726. visual feed back (as long as the character is on screen).
  1727.  
  1728. A small example of animation is presented in the JIMMY.SCR file
  1729. in the example game.  When asked to join the party, Jimmy will
  1730. walk over to his chest and retrieve his weapons, armor and
  1731. money.  He will then walk back towards the player and join the
  1732. party.
  1733.  
  1734. Automatic animation WILL be eventually handled by the system, so
  1735. don't go writing animation routines for every character in your
  1736. game.  This kind of animation should be used in specific
  1737. instances where you want things to happen that the user must not
  1738. be able to prevent or should not have to do him/herself.
  1739.  
  1740. Entering Doors
  1741.  
  1742. The player's party may move from one location to another in
  1743. several ways.  The simplest one is to use the Enter command to
  1744. enter a door.  The party will be transferred to the world and
  1745. destination that the door leads to.
  1746.  
  1747. NOTE: The party will NOT be transferred to the new location
  1748. until the script finishes execution.
  1749.  
  1750. Teleportation
  1751.  
  1752. If you wish to transfer the player to a specific world, you may
  1753. use the Teleport command.  This command allows you to specify a
  1754. destination world (by number) as well as either a door in the
  1755. destination world through which you wish to enter, or the actual
  1756. x and y location at which the party should appear.  Thus, a door
  1757. need not be present in the destination world.
  1758.  
  1759. Advanced Topics
  1760.  
  1761. Entry Points
  1762.  
  1763. Whenever a script is invoked, execution of the script will begin
  1764. at a special label which is called an Entry Point.  The entry
  1765. points are labels of the form :@# where # is a number between 0
  1766. and 20, but, to make life easier, the labels have specific names
  1767. associated with them, which make it easier to remember them. 
  1768. The entry points and the names associated with them are
  1769. different for each type of script, and are shown below:  You
  1770. should use the name form of the entry points unless you have a
  1771. very good reason for using the numbers.
  1772.  
  1773. For Character Scripts
  1774.  
  1775. @TALK        (0)    - Talk to the character
  1776.  
  1777. @DROP        (2)    - Character is being asked to leave the party
  1778.  
  1779. @CAST        (11)    - Character will try to cast a given spell.
  1780.  
  1781. For Object Scripts
  1782.  
  1783. @TALK        (0)    - Talk to an object.
  1784.  
  1785. @GET        (1)    - Move an object into the player's backpack.
  1786.  
  1787. @DROP        (2)    - Drop an object being carried.
  1788.  
  1789. @WEAR        (3)    - Wear an object.
  1790.  
  1791. @REMOVE    (4)    - Remove an object being worn.
  1792.  
  1793. @LOOK        (5)    - Look at an object.
  1794.  
  1795. @EXAMINE    (6)    - Examine an object carefully.
  1796.  
  1797. @INVOKE        (7)    - Invoke the magic in a magical object (ring,
  1798. amulet, etc)
  1799.  
  1800. @USE        (9)     - Use a generic object for whatever purpose it is
  1801. intended.
  1802.  
  1803. @EXIT        (10)    - The player's party wants to get out of a vehicle.
  1804.  
  1805. For World Scripts
  1806.  
  1807. @ENTER        (9)    - The player's party is entering the current world
  1808.  
  1809. @EXIT        (10)    - The player's party is leaving the current world
  1810.  
  1811. For Control Scripts
  1812.  
  1813. n/a            (0)    - Time Control Entry Point.
  1814.  
  1815. n/a            (1)    - Party wants to rest for the night.
  1816.  
  1817. n/a            (2)    - A member of the party wants to leave the group.
  1818.  
  1819. For Magic Spells
  1820.  
  1821. @CAST        (11)    - A magic user has casts a spell.
  1822.  
  1823. For Game Initialization
  1824.  
  1825. n/a            (0)    - Invoked at game initialization
  1826.  
  1827. For Dead and Resurrection
  1828.  
  1829. n/a            (0)    - Invoked when everyone in the party dies.
  1830.  
  1831. Calling A DOS program
  1832.  
  1833. From within a script, you may execute a DOS program by using the
  1834. system command.  This command works exactly like the writeln
  1835. command, except that instead of sending a line of text to the
  1836. text window, the text is formed into an MS-DOS command and
  1837. executed.  When the command ends execution, the MS-DOS error
  1838. level is stored in the failure variable.  A value of 0 usually
  1839. indicates success.
  1840.  
  1841. See the reference guide entry for additional information.
  1842.  
  1843. Creating New Types and Classes
  1844.  
  1845. When the current types and classes of characters, objects or
  1846. worlds is not enough, you may create your own types and classes
  1847. as needed.  The procedure for doing this is highlighted here,
  1848. the assumption is made that you have read the manuals and are
  1849. familiar with the script language before you attempt to add a
  1850. new type or class.
  1851.  
  1852. New Character Types
  1853.  
  1854. To create a new character type, you should edit the file
  1855. DCCTOKEN.DAT, look for the section [CHARACTER TYPES and add an
  1856. entry after the last character type in the file:
  1857.  
  1858.  
  1859.  
  1860. [CHARACTER TYPES]
  1861.  
  1862. REGULAR         0 ! REGULAR.SCR  - Will join the party if asked
  1863. to..
  1864.  
  1865. HOSTILE         1 ! HOSTILE.SCR  - Will attack on sight and
  1866. follow you..
  1867.  
  1868. MERCHANT        2 ! MERCHANT.SCR - Buys and Sells stuff..
  1869.  
  1870. BARTENDER       3 ! BARTENDE.SCR - Sells beer.  Good source of
  1871. information.
  1872.  
  1873. HEALER          4 ! HEALER.SCR   - Cure, Heal, Resurrect, Remove
  1874. Curse,..
  1875.  
  1876. CIVILIAN        5 ! CIVILIAN.SCR - Will talk, but won't join..
  1877.  
  1878. TELLER          6 ! TELLER.SCR   - Fortune Teller or Oracle
  1879. type..
  1880.  
  1881. QUESTER         7 ! QUESTER.SCR  - Asks you to find an object or
  1882. person.
  1883.  
  1884. BEGGAR          8 ! BEGGAR.SCR   - Want's money.  Might give you
  1885. a tip.
  1886.  
  1887. TRAINER         9 ! TRAINER.SCR  - Will train someone
  1888. (STR,DEX,AIM,IQ) 
  1889.  
  1890. GUARD          10 ! GUARD.SCR    - Blocks your way unless given
  1891. the password.
  1892.  
  1893. PRISONER       11 ! PRISONER.SCR - Will join your party
  1894. temporarily (to escape).
  1895.  
  1896. LAWYER         12
  1897.  
  1898. In the above segment, the new character type LAWYER has number
  1899. 12 assigned to it (the next available number).  You may now
  1900. write a script file called LAWYER.SCR to handle the default
  1901. behaviour of lawyers.
  1902.  
  1903. New Character Classes
  1904.  
  1905. Character classes in the current implementation apply only to
  1906. characters that join the party.  The class of the character is
  1907. used to determine what kind of weapons and armor they can use,
  1908. what kind of magic they have, how fast they recover, etc.
  1909.  
  1910. To create a new character class, just edit the DCCTOKEN.DAT file
  1911. and add the new class to the [CHARACTER CLASSES] section:
  1912.  
  1913.  
  1914.  
  1915. [CHARACTER CLASSES]
  1916.  
  1917. HUMAN           0 ! standard stuff, no power 
  1918.  
  1919. ELF             1 ! fast, magical power, not strong 
  1920.  
  1921. DWARF           2 ! slow, STRONG, no magic, no missiles or
  1922. shields 
  1923.  
  1924. WIZARD          3 ! slow, lot's of magic, not strong 
  1925.  
  1926. ARCHER          4 ! fast, no magic, + on missile weapons 
  1927.  
  1928. FIGHTER         5 ! fast, strong, no magic of any kind 
  1929.  
  1930. THIEF           6
  1931.  
  1932.  
  1933.  
  1934. In the above segment, the new character class THIEF has a number
  1935. 6 (next available one).
  1936.  
  1937. The DCBLOCK, DCWORLD, DCPLAY and DCREPORT programs will now
  1938. recognize thieves as a valid character type.
  1939.  
  1940. You may also want to modify the OBJECT and CASTING scripts to
  1941. give a thief certain advantages when dealing with traps, and to
  1942. enable or restrict the kinds of weapons, magic, etc, that the
  1943. character can handle.
  1944.  
  1945. New Object Types
  1946.  
  1947. Creating a new object type is again started by adding the new
  1948. type to the DCCTOKEN.DAT file.  The section [OBJECT TYPES]
  1949. contains the names and numbers for all object types.
  1950.  
  1951. Unlike characters, a single script handles all object types and
  1952. classes.  The OBJECT script should be extended to handle the new
  1953. object type for all it's entry points.
  1954.  
  1955. The object types Food, Weapon, Armor, Shield, Amulet, Ring and
  1956. Staff have special treatment because they can be worn by the
  1957. characters.  The Vehicle  object type also has special handling
  1958. because it can be used for transportation.  Other than these
  1959. special handling, you can modify the OBJECT script file as much
  1960. as you want.
  1961.  
  1962. New Object Classes
  1963.  
  1964. An object class is also represented by a section in the
  1965. DCCTOKEN.DAT file.  It is different from other sections in that
  1966. multiple object types may have the same class (for example:
  1967. rings, amulets, food, potions and gems all have the same class
  1968. set).
  1969.  
  1970. If your new object is going to have the same set of class items
  1971. that already exists for another type, just add the name to the
  1972. list, for example:
  1973.  
  1974. !
  1975.  
  1976. ! Magical Effects, Type 1
  1977.  
  1978. !
  1979.  
  1980. [OBJECT CLASS: FOOD, POTION, RING, AMULET, GEMS, WIDGET]
  1981.  
  1982. NONE            0 ! No magical effect
  1983.  
  1984. CURE            1 ! Remove POISON
  1985.  
  1986. HEAL            2 ! Restore some HP
  1987.  
  1988. POISON          3 ! (Trap) POISON drinker
  1989.  
  1990. RESTORE         4 ! Restore ALL HP
  1991.  
  1992. PLUS_STR        5 ! Increase STRENGTH
  1993.  
  1994. PLUS_DEX        6 ! Increase DEXTERITY
  1995.  
  1996. PLUS_SPD        7 ! Increase SPEED
  1997.  
  1998. PLUS_AIM        8 ! Increase AIM
  1999.  
  2000. PLUS_AC         9 ! Increase AC
  2001.  
  2002. PLUS_HP        10 ! Increase HP
  2003.  
  2004. PLUS_IQ        11 ! Increase IQ
  2005.  
  2006. PLUS_PWR       12 ! Increase POWER
  2007.  
  2008. Here, we have added the new object type WIDGET to the set of
  2009. objects that have personal magic.
  2010.  
  2011. You still have to modify the OBJECT script to handle the
  2012. object's class.  For example, 
  2013.  
  2014.  
  2015.  
  2016.   on object.type goto
  2017.  
  2018.    USE_FOOD,     USE_WEAPON,     USE_AMMO,      USE_ARMOR,     USE_SHIELD,
  2019.    USE_AMULET,   USE_RING,       USE_POTION,    USE_SCROLL,    USE_STAFF,
  2020.    USE_CHEST,    USE_KEYS,       USE_GEMS,      USE_BOOK,      USE_GOLDSACK,
  2021.    USE_TORCH,    USE_LANTERN,    USE_ROPE,      USE_HOOKS,     USE_MIRROR,
  2022.    USE_SIGN,     USE_VEHICLE,    USE_WIDGET;
  2023.   .
  2024.   .
  2025.   .
  2026.   :USE_AMULET
  2027.   :USE_RING
  2028.   :USE_ARMOR
  2029.  
  2030.   :USE_WEAPON
  2031.  
  2032.   :USE_SHIELD
  2033.   :USE_STAFF
  2034.      writeln( "You must first 'get' it, then 'wear' or 'wield' it.." );
  2035.      STOP;
  2036.  
  2037.   :USE_WIDGET
  2038.      writeln( "If you want to use it, you must first 'get' it.." );
  2039.      STOP;
  2040.   .
  2041.   .
  2042.  
  2043. Here, we have decided that a WIDGET must be in the player's
  2044. backpack before it can be used.
  2045.  
  2046. If your new object is different from all other objects, you can
  2047. create a brand new section for it's classes in the DCCTOKEN.DAT
  2048. file:
  2049.  
  2050. !
  2051.  
  2052. ! My WIDGET object classes
  2053.  
  2054. !
  2055.  
  2056. [OBJECT CLASS: widget]
  2057.  
  2058. ROUND        0 ! A round widget
  2059.  
  2060. SQUARE    1 ! A square widget
  2061.  
  2062. OVAL        2 ! An oval widget
  2063.  
  2064. At this point, you may create graphics blocks with type widget
  2065. and class round, square or oval.  You may also write script code
  2066. like this:
  2067.  
  2068. if object.type = widget then
  2069.   on object.class goto XROUND, XSQUARE, XOVAL;
  2070.   writeln( "Unknown widget class.." );
  2071.   stop;
  2072. endif;
  2073.  
  2074. :XROUND  ! Handle a round widget
  2075.  ....
  2076.  STOP;
  2077. :XSQUARE ! Handle a square widget
  2078.  ....
  2079.  STOP;
  2080. :XOVAL   ! Handle an oval widget
  2081.  ....
  2082.  STOP;
  2083.  
  2084. New Object Modifiers
  2085.  
  2086. Each object has 5 attributes that can be used to implement it's
  2087. differences from other objects.  These attributes have names m0
  2088. through m4, but the object modifiers section in the DCCTOKEN.DAT
  2089. file allows you to call them by other names.
  2090.  
  2091. When you create a new object type and/or class, you may want to
  2092. create new names for those fields that you might use to
  2093. differentiate between them  For example:
  2094.  
  2095. [OBJECT MODIFIERS]
  2096. ! Object Type: FOOD
  2097. !          0   Is not used
  2098. UNITS      1 ! If magical, how many units are affected
  2099. PERMANENT  2 ! If magical, how long does effect last? (0=one day, 1=permanent)
  2100. !          3   Is not used
  2101. !          4   Is not used
  2102.  
  2103. ! Object Type: WEAPON          
  2104. HANDS      0 ! # of hands needed to use the weapon
  2105. RANGE      1 ! Range of this weapon
  2106. DAMAGE     2 ! Damage done when using this weapon.
  2107. AMMONEEDED 3 ! Type of ammunition needed (See AMMOTYPE below..)
  2108. !          4   Is not used
  2109.  
  2110. ! Object Type: WIDGET
  2111. SIDES      0 ! # of sides that the widget has
  2112. RANGE      1 ! Range of this widget
  2113.  
  2114. Note that if you want to use a token that already has a value
  2115. assigned, like range in the example, which has a value 1
  2116. assigned for weapons, you MUST use the same value for the token.
  2117. Tokens are replaced by their numeric value during compilation,
  2118. so the following two lines are equivalent:
  2119.  
  2120. if object.hands = 7 then ...
  2121. if object.sides = 7 then ...
  2122.  
  2123. Both lines are comparing the m0 modifier of the object with the
  2124. value 7.  The type of the object is not checked to see that the
  2125. token you are using belongs to the object's type.
  2126.  
  2127. New World Types
  2128.  
  2129. Perhaps the easiest to create would be a new world type.  Again,
  2130. just add the entry to the DCCTOKEN.DAT file, section world
  2131. types,  and then edit the WORLDDEF script file to handle the new
  2132. world type.
  2133.  
  2134. Note that many of the currently defined world types have no
  2135. actual differences between them.  For example, Cities, Towns,
  2136. Hideouts, Houses and Castles are all the same..  You can change
  2137. that by modifying the appropriate scripts.
  2138.  
  2139. For example: If you want to make opening a locked chest a crime
  2140. in Castles and Houses, you can add a check in the OBJECT script
  2141. to verify the type of world you are in when the character tries
  2142. to break a lock.
  2143.  
  2144. Shareware Opportunities
  2145.  
  2146. While most users will use the script language to make small
  2147. changes to the game system, with a few customized scripts to
  2148. handle special characters or objects, the true power of scripts
  2149. lies in the ability to completely change the way everything
  2150. works.  Here are a few example of some more complex projects
  2151. that you may want to attempt once you are comfortable writing
  2152. scripts:
  2153.  
  2154. Extending the magic system
  2155.  
  2156.  
  2157.  
  2158. The current magic system allows a character to cast a spell if
  2159. it has the required number of power points.  There is no
  2160. requirement to learn the spells, or to be at a certain level
  2161. before you can cast it.  You can change the OBJECT and CASTING
  2162. scripts to handle a magic book, which can be either a class of
  2163. book (currently, books don't have classes) or a whole new type
  2164. of object (Magic Book).
  2165.  
  2166. You can also change the scripts to handle a lot more spells (up
  2167. to 255 of each type), or add a level requirement for each spell.
  2168.  
  2169. MS-DOS based extensions
  2170.  
  2171. The system command allows you to run DOS programs from within a
  2172. script.  The following DOS programs could be called from a
  2173. script to extend the functionality of the system.  Writing these
  2174. extensions requires knowledge about internal structures of the
  2175. game files, which I will be glad to provide on a case by case
  2176. basis.
  2177.  
  2178. Save/Restore/Restart
  2179.  
  2180. Replace the prompts that perform this function with a window
  2181. that shows saved games along with comments and let's you choose
  2182. which one you want to restore, or lets you specify which slot
  2183. you want to save in, and what comment you want to associate with
  2184. the saved game.
  2185.  
  2186. Character Editor
  2187.  
  2188. Allows you to examine/modify (i.e. cheat) the PARTY file.
  2189.  
  2190. Arcade/Casino extensions
  2191.  
  2192. A completely separate sub-game that is executed when you enter a
  2193. world.  For example, when you enter a casino, you can run a DOS
  2194. game that allows the user to play poker or some other games in
  2195. order to make money.  The program may read the PARTY file to get
  2196. the names of the characters and the amount of gold they have. 
  2197. It would update the gold amount when the characters leave the
  2198. casino.
  2199.  
  2200. Stand Alone Utilities
  2201.  
  2202. A nice utility would be one that can take the game and create
  2203. PCX graphics files for each world, optionally including the
  2204. objects and characters that appear in it.  The PCX file can then
  2205. be scaled and manipulated by other utilities to print maps or
  2206. include the graphics in documentation.
  2207.  
  2208. Writing a whole new system
  2209.  
  2210. It is perfectly feasible to take the rules, character types,
  2211. magic system, etc of game systems such as Dungeons and Dragonstm
  2212. or Man, Myth and Magictm and write them as scripts.  You would
  2213. have to throw away all of the current scripts and write them
  2214. from scratch, but it's perfectly feasible. Of course, these
  2215. systems are copyrighted by their respective publishers, so it
  2216. wouldn't be possible to distribute such a system as shareware (I
  2217. think, but I'm not a copyright expert).
  2218.  
  2219.